// @flow
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
import { TurboModuleRegistry } from 'react-native';

/// Geometric shape interface
export interface Spec extends TurboModule {
    /**
     * Insert geometric shape
     * Geometric shape coordinates are in px
     * polygonData: Geometric shape data, two types:
     * Polygon and Circle, determined by type field
     * Polygon data format:
     * {
     * // type=1 for polygon
     * "type": 1,
     * // Top-left vertex coordinates of geometric shape
     * // Relative to note page coordinates
     * "left": "int",
     * "top": "int",
     * // Point coordinates of geometric shape, connected in sequence
     * // Coordinates relative to top-left vertex (0,0)
     * "pointList": [
     *    {"x": "int", "y": "int"},
     *    {"x": "int", "y": "int"} ],
     * // Whether it's an arrow, default false, if true last point has arrow
     * "arrows": false,
     * // Line width
     * "lineWidth": "double",
     * // Line color
     * "lineColor": "int",
     * // Fill color, shape must be closed, no effect if not closed
     * "fillColor": "int"
     * }
     * 
     * Circle data format:
     * {
     * // type=2 for circle data
     * "type": 1,
     * // Top-left vertex coordinates for insertion
     * "left": "int", 
     * "top": "int",
     * // Center coordinates
     * "centerX": "int",
     * "centerY": "int",
     * // Radius
     * "radius": "int",
     * // Line width
     * "lineWidth": "double",
     * // Line color
     * "lineColor": "int",
     * // Fill color, shape must be closed
     * "fillColor": "int"
     * }
     * Different parameters passed based on data type
     * 
     * Returns insertion success or failure
     */
    insertPolygon(polygonData: Object): Promise<boolean>;

    /** 
     * Get current geometric shape data for editing
     * Returns two types of data: polygon and circle, determined by type field
     * Polygon data format:
     * {
     * // type=1 for polygon
     * "type": 1,
     * // Top-left vertex coordinates of geometric shape
     * // Relative to note page coordinates
     * "left": "int",
     * "top": "int",
     * // Point coordinates of geometric shape, connected in sequence
     * // Coordinates relative to top-left vertex (0,0)
     * "pointList": [
     *    {"x": "int", "y": "int"},
     *    {"x": "int", "y": "int"} ],
     * // Whether it's an arrow, default false, if true last point has arrow
     * "arrows": false,
     * // Line width
     * "lineWidth": "double",
     * // Line color
     * "lineColor": "int",
     * // Fill color, shape must be closed, no effect if not closed
     * "fillColor": "int"
     * }
     * 
     * Circle data format:
     * {
     * // type=2 for circle data
     * "type": 1,
     * // Top-left vertex coordinates for insertion
     * "left": "int",
     * "top": "int",
     * // Center coordinates
     * "centerX": "int",
     * "centerY": "int",
     * // Radius
     * "radius": "int",
     * // Line width
     * "lineWidth": "double",
     * // Line color
     * "lineColor": "int",
     * // Fill color, shape must be closed
     * "fillColor": "int"
     * }
     */ 
    getCurrentEditPolygon():Promise<Object>;

}

export default (TurboModuleRegistry.get < Spec > (
    'RTNPolygon'
):?Spec);